import variables from "@/styles/variables.modules.scss";
import {generateColors} from "@/utils/theme";
import {getItem} from "@/utils/storage";
import {MAIN_COLOR} from "@/constant";

const getters = {
  // token: state => state.user.token
  token: (state) => {
    // console.log("state:",state);
    // {
    //   "user": {
    //     "token": "803fa331-767c-4143-b449-91a45af66327"
    //   }
    // }
    return state.user.token;
  },
  userInfo: (state) => state.user.userInfo,
  hasUserInfo: (state) => {
    return JSON.stringify(state.user.userInfo) !== "{}";
  },
  cssVar: (state) => ({
    ...state.theme.variables,
    ...generateColors(getItem(MAIN_COLOR))
  }),
  sidebarOpened: (state) => state.app.sidebarOpened,
  language:state=>state.app.language,
  mainColor: state => state.theme.mainColor,
  tagsViewList: state => state.app.tagsViewList
};
export default getters;
